<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <form>
            <div>
              <label for="fname">First name: </label>
              <input id="fname" type="text">
            </div>
            <div>
              <label for="lname">Last name: </label>
              <input id="lname" type="text">
            </div>
            <div>
               <input id="submit" type="submit">
            </div>
          </form>
          <p></p>
    </div>
    <script>
        const form = document.querySelector('form');
        const fname = document.getElementById('fname');
        const lname = document.getElementById('lname');
        const submit = document.getElementById('submit');
        const para = document.querySelector('p');

        form.onsubmit = function(e) {
            if (fname.value === '' || lname === '') {
                e.preventDefault();
                para.textContent = 'please enter'
            }
        }
    </script>
</body>
</html>